.class Lcom/nemustech/regina/ReginaCheckForUpdate$6;
.super Ljava/lang/Thread;
.source "ReginaCheckForUpdate.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/nemustech/regina/ReginaCheckForUpdate;->readServerXML()V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;


# direct methods
.method constructor <init>(Lcom/nemustech/regina/ReginaCheckForUpdate;)V
    .locals 0
    .parameter

    .prologue
    .line 342
    iput-object p1, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 13

    .prologue
    const/4 v9, 0x0

    const/4 v11, 0x1

    .line 345
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v8, v9}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$502(Lcom/nemustech/regina/ReginaCheckForUpdate;I)I

    .line 346
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    new-instance v9, Ljava/util/ArrayList;

    invoke-direct {v9}, Ljava/util/ArrayList;-><init>()V

    invoke-static {v8, v9}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$402(Lcom/nemustech/regina/ReginaCheckForUpdate;Ljava/util/ArrayList;)Ljava/util/ArrayList;

    .line 348
    :try_start_0
    invoke-static {}, Lorg/xmlpull/v1/XmlPullParserFactory;->newInstance()Lorg/xmlpull/v1/XmlPullParserFactory;

    move-result-object v2

    .line 349
    .local v2, factory:Lorg/xmlpull/v1/XmlPullParserFactory;
    const/4 v8, 0x1

    invoke-virtual {v2, v8}, Lorg/xmlpull/v1/XmlPullParserFactory;->setNamespaceAware(Z)V

    .line 350
    invoke-virtual {v2}, Lorg/xmlpull/v1/XmlPullParserFactory;->newPullParser()Lorg/xmlpull/v1/XmlPullParser;

    move-result-object v7

    .line 352
    .local v7, xpp:Lorg/xmlpull/v1/XmlPullParser;
    new-instance v6, Ljava/net/URL;

    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    const-string v9, "http://regina.nemustech.com/"

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    iget-object v9, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v9}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$600(Lcom/nemustech/regina/ReginaCheckForUpdate;)Z

    move-result v9

    if-eqz v9, :cond_1

    const-string v9, "version.xml"

    :goto_0
    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-direct {v6, v8}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    .line 353
    .local v6, u:Ljava/net/URL;
    invoke-virtual {v6}, Ljava/net/URL;->openStream()Ljava/io/InputStream;

    move-result-object v3

    .line 354
    .local v3, in:Ljava/io/InputStream;
    const-string v8, "utf-8"

    invoke-interface {v7, v3, v8}, Lorg/xmlpull/v1/XmlPullParser;->setInput(Ljava/io/InputStream;Ljava/lang/String;)V

    .line 356
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->getEventType()I

    move-result v1

    .line 358
    .local v1, eventType:I
    const/4 v4, 0x0

    .line 359
    .local v4, record:Lcom/nemustech/regina/XMLRecord;
    const-string v8, "ReginaCheckForUpdate"

    const-string v9, "Start Parsing XML"

    iget-object v10, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v10}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$100(Lcom/nemustech/regina/ReginaCheckForUpdate;)Z

    move-result v10

    invoke-static {v8, v9, v10}, Lcom/nemustech/regina/RLog;->d(Ljava/lang/String;Ljava/lang/String;Z)I

    .line 360
    :goto_1
    if-eq v1, v11, :cond_a

    .line 361
    packed-switch v1, :pswitch_data_0

    .line 401
    :cond_0
    :goto_2
    :pswitch_0
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->next()I

    move-result v1

    goto :goto_1

    .line 352
    .end local v1           #eventType:I
    .end local v3           #in:Ljava/io/InputStream;
    .end local v4           #record:Lcom/nemustech/regina/XMLRecord;
    .end local v6           #u:Ljava/net/URL;
    :cond_1
    const-string v9, "market.xml"

    goto :goto_0

    .line 367
    .restart local v1       #eventType:I
    .restart local v3       #in:Ljava/io/InputStream;
    .restart local v4       #record:Lcom/nemustech/regina/XMLRecord;
    .restart local v6       #u:Ljava/net/URL;
    :pswitch_1
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;

    move-result-object v5

    .line 368
    .local v5, sTag:Ljava/lang/String;
    const-string v8, "item"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_2

    .line 369
    new-instance v4, Lcom/nemustech/regina/XMLRecord;

    .end local v4           #record:Lcom/nemustech/regina/XMLRecord;
    invoke-direct {v4}, Lcom/nemustech/regina/XMLRecord;-><init>()V

    .restart local v4       #record:Lcom/nemustech/regina/XMLRecord;
    goto :goto_2

    .line 370
    :cond_2
    const-string v8, "name"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_3

    .line 371
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->nextText()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setAppName(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_2

    .line 404
    .end local v1           #eventType:I
    .end local v2           #factory:Lorg/xmlpull/v1/XmlPullParserFactory;
    .end local v3           #in:Ljava/io/InputStream;
    .end local v4           #record:Lcom/nemustech/regina/XMLRecord;
    .end local v5           #sTag:Ljava/lang/String;
    .end local v6           #u:Ljava/net/URL;
    .end local v7           #xpp:Lorg/xmlpull/v1/XmlPullParser;
    :catch_0
    move-exception v8

    move-object v0, v8

    .line 406
    .local v0, e:Ljava/lang/Exception;
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v8}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$400(Lcom/nemustech/regina/ReginaCheckForUpdate;)Ljava/util/ArrayList;

    move-result-object v8

    invoke-virtual {v8}, Ljava/util/ArrayList;->clear()V

    .line 407
    new-instance v4, Lcom/nemustech/regina/XMLRecord;

    invoke-direct {v4}, Lcom/nemustech/regina/XMLRecord;-><init>()V

    .line 408
    .restart local v4       #record:Lcom/nemustech/regina/XMLRecord;
    const-string v8, "ReginaLauncher"

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setAppName(Ljava/lang/String;)V

    .line 409
    const-string v8, "com.nemustech.regina"

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setPackageName(Ljava/lang/String;)V

    .line 410
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-virtual {v4}, Lcom/nemustech/regina/XMLRecord;->getPackageName()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Lcom/nemustech/regina/ReginaCheckForUpdate;->getCurrentVersion(Ljava/lang/String;)I

    move-result v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setCurrentVersion(I)V

    .line 411
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v8}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$400(Lcom/nemustech/regina/ReginaCheckForUpdate;)Ljava/util/ArrayList;

    move-result-object v8

    invoke-virtual {v8, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 412
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v8, v11}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$502(Lcom/nemustech/regina/ReginaCheckForUpdate;I)I

    .line 414
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    .line 416
    .end local v0           #e:Ljava/lang/Exception;
    :goto_3
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    new-instance v9, Lcom/nemustech/regina/XMLRecordAdapter;

    iget-object v10, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    const v11, 0x7f03000d

    iget-object v12, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v12}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$400(Lcom/nemustech/regina/ReginaCheckForUpdate;)Ljava/util/ArrayList;

    move-result-object v12

    invoke-direct {v9, v10, v11, v12}, Lcom/nemustech/regina/XMLRecordAdapter;-><init>(Landroid/content/Context;ILjava/util/ArrayList;)V

    invoke-static {v8, v9}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$302(Lcom/nemustech/regina/ReginaCheckForUpdate;Lcom/nemustech/regina/XMLRecordAdapter;)Lcom/nemustech/regina/XMLRecordAdapter;

    .line 417
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    iget-object v9, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v9}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$300(Lcom/nemustech/regina/ReginaCheckForUpdate;)Lcom/nemustech/regina/XMLRecordAdapter;

    move-result-object v9

    invoke-virtual {v8, v9}, Lcom/nemustech/regina/ReginaCheckForUpdate;->setListAdapter(Landroid/widget/ListAdapter;)V

    .line 418
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    iget-object v8, v8, Lcom/nemustech/regina/ReginaCheckForUpdate;->hViewSwitcher:Landroid/os/Handler;

    iget-object v9, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v9}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$500(Lcom/nemustech/regina/ReginaCheckForUpdate;)I

    move-result v9

    invoke-virtual {v8, v9}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    .line 419
    return-void

    .line 372
    .restart local v1       #eventType:I
    .restart local v2       #factory:Lorg/xmlpull/v1/XmlPullParserFactory;
    .restart local v3       #in:Ljava/io/InputStream;
    .restart local v5       #sTag:Ljava/lang/String;
    .restart local v6       #u:Ljava/net/URL;
    .restart local v7       #xpp:Lorg/xmlpull/v1/XmlPullParser;
    :cond_3
    :try_start_1
    const-string v8, "package"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_4

    .line 373
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->nextText()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setPackageName(Ljava/lang/String;)V

    goto/16 :goto_2

    .line 374
    :cond_4
    const-string v8, "ver"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_5

    .line 375
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->nextText()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setServerVersion(Ljava/lang/String;)V

    goto/16 :goto_2

    .line 376
    :cond_5
    const-string v8, "date"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_6

    .line 377
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->nextText()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setDate(Ljava/lang/String;)V

    goto/16 :goto_2

    .line 378
    :cond_6
    const-string v8, "path"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_7

    .line 379
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->nextText()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setUrl(Ljava/lang/String;)V

    goto/16 :goto_2

    .line 380
    :cond_7
    const-string v8, "reset_target_path"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_8

    .line 381
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->nextText()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->addResetItem(Ljava/lang/String;)V

    goto/16 :goto_2

    .line 382
    :cond_8
    const-string v8, "changelog"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_9

    .line 383
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->nextText()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setChangeLog(Ljava/lang/String;)V

    goto/16 :goto_2

    .line 384
    :cond_9
    const-string v8, "appid"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_0

    .line 385
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->nextText()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setAppid(Ljava/lang/String;)V

    goto/16 :goto_2

    .line 389
    .end local v5           #sTag:Ljava/lang/String;
    :pswitch_2
    invoke-interface {v7}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;

    move-result-object v5

    .line 390
    .restart local v5       #sTag:Ljava/lang/String;
    const-string v8, "item"

    invoke-virtual {v5, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_0

    .line 391
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-virtual {v4}, Lcom/nemustech/regina/XMLRecord;->getPackageName()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Lcom/nemustech/regina/ReginaCheckForUpdate;->getCurrentVersion(Ljava/lang/String;)I

    move-result v8

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setCurrentVersion(I)V

    .line 392
    const/4 v8, 0x0

    invoke-virtual {v4, v8}, Lcom/nemustech/regina/XMLRecord;->setTargeted(Z)V

    .line 393
    iget-object v8, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v8}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$400(Lcom/nemustech/regina/ReginaCheckForUpdate;)Ljava/util/ArrayList;

    move-result-object v8

    invoke-virtual {v8, v4}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto/16 :goto_2

    .line 403
    .end local v5           #sTag:Ljava/lang/String;
    :cond_a
    const-string v8, "ReginaCheckForUpdate"

    const-string v9, "Finish parsing XML"

    iget-object v10, p0, Lcom/nemustech/regina/ReginaCheckForUpdate$6;->this$0:Lcom/nemustech/regina/ReginaCheckForUpdate;

    invoke-static {v10}, Lcom/nemustech/regina/ReginaCheckForUpdate;->access$100(Lcom/nemustech/regina/ReginaCheckForUpdate;)Z

    move-result v10

    invoke-static {v8, v9, v10}, Lcom/nemustech/regina/RLog;->d(Ljava/lang/String;Ljava/lang/String;Z)I
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto/16 :goto_3

    .line 361
    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_0
    .end packed-switch
.end method
